//
// 
// Copyright (c) 2011, blueflycn at gmail dot com
// All rights reserved
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License. You should have
// received a copy of the GPL license along with this program; if you
// did not, you can find it at http://www.gnu.org/
//

#include <stdint.h>

/*
#include <stdio.h>
#include <stdint.h>
#include <time.h>
#include <errno.h>
#include <assert.h>
#include <ctype.h>
#include <fcntl.h>
#include <sys/time.h>
#include <float.h>
#include "malloc.h"
*/
//improved Simple 16 algorithm
//we defined 15 bit-strategies from 1-15, 4 bits '1111' for decoding termination tag
//here we use a byte to store 2 bit-strategies, with 4 bits for each bit-strategy
//!!IMPORTANT be aware of the bit-strategy's storage order, from the biggest capacity to the smallest



extern inline size_t iS16_encode32(uint32_t *in, size_t cnt_in, uint8_t *out) ;
extern inline size_t iS16_decode32(uint8_t *in, uint32_t *out, size_t *bytes_read) ;
extern inline size_t iS16_encode64(uint64_t *in, size_t cnt_in, uint8_t *out) ;
extern inline size_t iS16_decode64(uint8_t *in, uint64_t *out, size_t *bytes_read) ;
extern inline size_t tyn_p4d_encode32(uint32_t *in, size_t cnt_in, uint8_t *out, int add_termination) ;
extern inline size_t tyn_p4d_decode32(uint8_t *in, uint32_t *out, size_t *bytes_read) ;
extern inline size_t tyn_p4d_encode64(uint64_t *in, size_t cnt_in, uint8_t *out, int add_termination);
extern inline size_t tyn_p4d_decode64(uint8_t *in, uint64_t *out, size_t *bytes_read);